/*
============================================================================
 Name        : fImage.cpp
 Author      : 
 Version     :
 Copyright   : 
 Description : fImage implementation
============================================================================
*/

#include "fImage.h"
#include "ApplicationScheme.h"
#include "ProjectsDefines.h"


void fImage::ConstructL(TSize aSize)
{
	iBitmap = new(ELeave) CFbsBitmap();
	iBitmap->Create(aSize,f_IMAGE_DEPTH);
	iAlphaChannel = new(ELeave) CFbsBitmap();
	iAlphaChannel->Create(aSize,EGray256);
	iIsTrans = EFalse;
}


fImage::~fImage()
{
	SAFE_DELETE(iBitmap);
	SAFE_DELETE(iAlphaChannel);
}

fImage::fImage()
{	
}


fImage* fImage::NewLC(TSize aSize)
{
	fImage* self = new (ELeave)fImage();
	CleanupStack::PushL(self);
	self->ConstructL(aSize);
	return self;
}

fImage* fImage::NewL(TSize aSize)
{
	fImage* self=fImage::NewLC(aSize);
	CleanupStack::Pop(); 
	return self;
}

void fImage::Resize( const TSize& aSize )
{

	if (iBitmap)
	{
		iBitmap->Resize(aSize);
	}
	if (iAlphaChannel)
	{
		iAlphaChannel->Resize(aSize);
	}
	
}

void fImage::Resize( const TInt& aWidth,const TInt& aHeight )
{
	if (iBitmap)
	{
		iBitmap->Resize(TSize(aWidth,aHeight));
	}
	if (iAlphaChannel)
	{
		iAlphaChannel->Resize(TSize(aWidth,aHeight));
	}
		

}

//end of file
